package com.seek.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.gexin.rp.sdk.base.IPushResult;
import com.gexin.rp.sdk.base.impl.SingleMessage;
import com.gexin.rp.sdk.base.payload.APNPayload;
import com.gexin.rp.sdk.http.IGtPush;
import com.gexin.rp.sdk.template.APNTemplate;

public class IosPushtoSingle {
	private static Logger logger = LoggerFactory.getLogger(IosPushtoSingle.class);
	
	
    static String appId = "7Fh67fzAcI6kkz6DO2h8r8";
    static String appKey = "txCsy6Ogtm5jhD3oxFiwf2";
    static String masterSecret = "L0obigCOII983gpkkxVNu5";
    static String devicetoken = "D70D7F357E407819AACBF1B32E5F710E84078853ED1A0692463E9FCDF3D8A11E";
    static String url ="http://sdk.open.api.igexin.com/serviceex";
       public static void apnpush() throws Exception {
              IGtPush push = new IGtPush(url, appKey, masterSecret);  
              APNTemplate template = new APNTemplate();
              APNPayload apnpayload = new APNPayload();
              apnpayload.setSound("");
              APNPayload.DictionaryAlertMsg alertMsg = new APNPayload.DictionaryAlertMsg();
              alertMsg.setTitle("aaaaaa");
              alertMsg.setBody("bbbb");
              alertMsg.setTitleLocKey("ccccc");
              alertMsg.setActionLocKey("ddddd");
              apnpayload.setAlertMsg(alertMsg);
   
              template.setAPNInfo(apnpayload);
              SingleMessage sm = new SingleMessage();
              sm.setData(template);
              IPushResult ret0 = push.pushAPNMessageToSingle(appId, devicetoken, sm);
              System.out.println(ret0.getResponse());
              
       }
       
       public static void main(String[] args) throws Exception {
              apnpush();
       }
}
